// immer的核心就是子节点如果改变了，那么会向上走一直到根节点都是重新创建，但兄弟节点等都会复用原来的节点
/* 
import { produce } from 'immer';
let baseState = {name:'ikki'}
//传入老状态和处理方法，返回一个新状态
let nextState = produce(baseState, (draft) => { //draft大概就是浅拷贝
  draft.name = 2333
})
console.log(baseState===nextState); //false 
*/


import { produce } from './immer/index'
const baseState = {
  list: ['1']
}
const result = produce(baseState, (draft) => {
  debugger
  draft.list.push('2')
})
console.log(baseState); //['1']
console.log(result); //['1','2'] 
